<form id="inputForm" action="#(base)/admin/form_data/update" method="post">
	<input type="hidden" name="id" value="#(formData.id)" />
   	<input type="hidden" name="formId" value="#(formId)">
	<!--表单信息-->
	<div class="panel panel-default" style="padding-bottom: 10px;">
		<div class="panel-heading">表单信息</div>
		<div class="row data-type">
			#for(formField : formFields)
		    <div class="col-md-2 title">#(formField.alias)</div>
		    <div class="col-md-10 data">
		        <input type="text" class="form-control" placeholder="#(formField.alias)" name="#(formField.name)" value="#(formData.get(formField.name))">
		    </div>
		    #end
		</div>
		<!--工具栏-->
		<div class="box-tools text-center">
		    <button type="submit" class="btn bg-maroon">保存</button>
		    <button type="button" class="btn bg-default" id="backButton">返回</button>
		</div>
		<!--工具栏/-->
	</div>
	<!--表单信息/-->
</form>
<!---->
<script type="text/javascript">
$().ready(function() {

    var $inputForm = $("#inputForm");
    
    $("#backButton").on("click",function(){
    	formBack();
    });
    
    // 表单验证
    $inputForm.validate({
        rules: {
        },
		submitHandler: function(form) {
			$.ajax({
				url: $(form).attr("action"),
				type: $(form).attr("method"),
				data: $(form).serialize(),
				dataType: "json",
				cache: false,
				success: function(response) {
					if (response.type == "success") {
						swal({title:'', text:'操作成功',icon: 'success',button:false,timer: 2000}).then(function(){
							formBack();
						});
		            }else{
		                swal({title:'', text:response.msg,icon: 'error'});
		            }
				}
			});
			return false;
		}
    });

});
</script>